{include file="pageheader.htm"}
<div class="main-div">
  <form action="city.php"  method="post" name="theForm" onsubmit="return validate();">
  <table width="100%" id="general-table">
      <tr>
        <td class="label">城市名称</td>
        <td>
          <input type='text' name='name' value="{$attr.name}" size='30' />
          {$lang.require_field}
        </td>
      </tr>
      <tr>
        <td class="label">所属地区</td>
        <td>
          <select name="aid" onchange="onChangeGoodsType(this.value)">
          <option value="0">{$lang.select_please}</option>
            {$goods_type_list}
          </select> {$lang.require_field}
        </td>
      </tr>
      <tr>
        <td class="label">排序</td>
        <td>
          <input type='text' name='sort' value="{$attr.sort}" size='30' />
          {$lang.require_field}
        </td>
      </tr>
      <tr>
        <td colspan="2">
        <div class="button-div">
          <input type="submit" value="{$lang.button_submit}" class="button"/>
          <input type="reset" value="{$lang.button_reset}" class="button" />
        </div>
        </td>
      </tr>
      </table>
    <input type="hidden" name="act" value="{$form_act}" />
    <input type="hidden" name="cid" value="{$attr.cid}" />
  </form>
</div>
{insert_scripts files="../js/utils.js,validator.js"}
{literal}
<script language="JavaScript">
<!--
onload = function()
{
{/literal}
  radioClicked({$attr.attr_input_type});
  onChangeGoodsType({$attr.cat_id});
  // 开始检查订单
  startCheckOrder();
{literal}
}

/**
 * 检查表单输入的数据
 */
function validate()
{
  var ele = document.forms['theForm'].elements;
  var msg = '';

  if (Utils.trim(ele['name'].value) == '')
  {
    msg += name_not_null + '\n';
  }

  if (ele['aid'].value == 0)
  {
    msg += cat_id_not_null + '\n';
  }

  if (ele['attr_input_type'][1].checked && Utils.trim(ele['attr_values'].value) == '')
  {
    msg += values_not_null + '\n';
  }

  if (msg.length > 0)
  {
    alert(msg);
    return false;
  }
  else
  {
    return true;
  }
}

</script>
{/literal}
{include file="pagefooter.htm"}
